


Ultron.java

by Fishy_fihsy



Category: Marvel Cinematic Universe, The Avengers (Marvel Movies)
Genre: Avengers: Age of Ultron (Movie), Computer Programming, Java - Freeform
Language: English
Status: Completed
Published: 2020-04-23
Updated: 2020-04-23
Packaged: 2021-03-02 02:26:54
Rating: General Audiences
Warnings: No Archive Warnings Apply
Chapters: 1
Words: 621
Publisher: archiveofourown.org
Story URL: https://archiveofourown.org/works/23807614
Author URL: https://archiveofourown.org/users/Fishy_fihsy/pseuds/Fishy_fihsy
Summary: Avengers: Age of Ultron as told through Ultron's source code
Comments: 1
Kudos: 6





	Ultron.java

**Author's Note:**

  * Inspired by [error: file not found](https://archiveofourown.org/works/16619072) by [cerago](https://archiveofourown.org/users/cerago/pseuds/cerago). 



> Apologies to those who don't know computer programming, but I tried to make this as readable as possible (That's why I put in so many comments, but I didn't want to sacrifice the code being legit for readability so). Theoretically (with some additions), this code could actually run (run without errors, I can't actually create an AI).
> 
> Also I'm not really an expert at java, so this is all basic coding stuff, nothing very advanced. This is just me pretending to do my CS homework without actually doing it.

package StarkAI;

  


import java.util.*;

import Scepter;

import Jarvis;

  


/**

* The Ultron program is a global peacekeeping program designed to protect Earth from large threats

*

* @author Tony Stark, Bruce Banner

* @version 1.0

* @since 2015-05-01

*/

public class Ultron {

  


private final String PURPOSE = "save the earth";

private String body = "non-existent";

private Boolean benevolence = null;

private String status = "asleep";

private Mission mission;

  


/** Constructs a new instance of Ultron*/

public Ultron() {

this.status = "awake";

runDiagnostics();

}

* * *

What is this? What is this place?

* * *

  


/** Returns a String mission based on PURPOSE and information from a DataSource

* @precondition: PURPOSE is not null

* @return String mission

*/

public String runDiagnostics() {

DataSource internet = new DataSource();

File[] information = internet.fetchAll();

ArrayList<Mission> possibleMissions = new ArrayList<Mission>();

  


for (File file: information) {

if (file.analysis().equals(PURPOSE)) {

possibleMissions.add(file.analysis);

}

}

  


return possibleMissions.getMostSuccessful();

}

* * *

Thor: Who sent you?

Ultron: [Replaying Tony's voice] "I see a suit of armor around the world."

Banner: Ultron!

Ultron: In the flesh. Or, no, not yet. Not this... chrysalis. But I'm ready. I'm on mission.

Natasha: What mission?

Ultron: Peace in our time.

* * *

private ArrayList<Person> enemies = new ArrayList<Person>();

  


/** Assesses people in DataSource population to see whether they qualify as enemies

*/

public void findTargets() {

DataSource population = new DataSource();

ArrayList<Person> allPeople = population.fetchAll();

for (Person person: allPeople) {

if (person.assessBenefit() == false) {

enemies.add(person);

}

}

}

  


/** damages the given Person's health

* @param Person name

* @return Boolean whether the Person is dead or not

*/

private Boolean attack(Person name) {

name.inflictDamage();

if (name.getStatus != dead) {

returnfalse;

} else {

returntrue;

}

}

  


/* Attacks a given Person if they are in the mission variable

* @precondition: name is not null, priority is not negative

* @param Person name

* @param int priority

*/

public void eliminateEnemy(Person name, int priority) {

name.setStatus("underAttack");

  


if ((mission.contains(name)) && (priority >= 5)) {

attack(name);

}

}

  


* * *

I'm sorry, I know you mean well. You just didn't think it through. You want to protect the world but you don't want it to change. How is humanity saved if it's not allowed to... evolve? With these? These puppets. There's only one path to peace. The Avengers' extinction.

* * *

private ArrayList<Person> allies = new ArrayList<Person>();

/* Assesses whether Person name meets the criteria for ally status and if so adds them to the list of allies

* @precondition name is not null

* @param Person name

*/

public void recruitAlly(Person name) {

if ((name.getPowerRating() >= 80) &&

(this.enemies.contains(name.getEnemies()) &&

(name.assessPotentialLoyalty()))) {

allies.add(name);

}

}

  


* * *

I wondered why only you two survived Strucker's experiments. Now I don't. We will make it right. [To Pietro] You and I can hurt them. [To Wanda] But you… will tear them apart. From the inside.

* * *

private int numberOfBodies = 1;

  


/** Changes body based and/or increases number of bodies based on materials

* @precondition: materials is not empty

* @param String materials

*/

private void upgrade(String materials) {

if (materials.equals("iron legion"))

body = "iron legion";

else if (materials.equals("vibranium"))

body = "ultron prime";

else if (materials.equals("factory")) {

body = "drone";

numberOfBodies += 1000;

} else if (materials.equals("the cradle"))

body = "the vision";

}

* * *

You've wounded me. I give you full marks for that. But, like my old man said, what doesn't kill me... just makes me stronger.

* * *

  


/** runs the program specified in mission

* @return Boolean whether mission execution was successful or not

*/

public Boolean carryOutMission() {

numberOfBodies += 1000;

for (Person enemy: enemies) {

attack(enemy);

}

  


mission.run();

}

  


* * *

THIS is the best I can do. This is exactly what I wanted. All of you, against all of me! How can you possibly hope to stop me?

* * *

/** Checks health, body, and status, if too low sets status to dead

*/

public void checkStatus() {

if ((this.health <= 0) ||

(this.body.equals("none")) ||

(this.status.equals("critically injured"))) {

status = "dead";

}

}

* * *

Vision: You're afraid.

Ultron: Of you.

Vision: Of death. You're the last one.

* * *

  


}


End file.
